******************
**** Table B10 ****
****************** 

use "$data/paymentdata_ready" , clear

gen above=0 if interventionratiow1<1
replace above=1 if interventionratiow1>=1

keep if t==1

*** PANEL A ***
preserve
keep if above==0

log using "$output/table b10", replace


reg postratiow1 treatmentidentityd2 treatmentidentityd3 treatmentidentityd4 teamdummy* firststickerdummy*, cluster(dayteam)
test treatmentidentityd2 = treatmentidentityd3
test treatmentidentityd2 = treatmentidentityd4
test treatmentidentityd3 = treatmentidentityd4

reg postratiow1 treatmentidentityd2 treatmentidentityd3 treatmentidentityd4 teamdummy* firststickerdummy* preratiow1 lastdebt_demeanedw1 prepaymentsmadedummy* , cluster(dayteam)
test treatmentidentityd2 = treatmentidentityd3
test treatmentidentityd2 = treatmentidentityd4
test treatmentidentityd3 = treatmentidentityd4

capture program drop Ey_boot
program define Ey_boot, eclass
twopm postratiow1 treatmentidentityd2 treatmentidentityd3 treatmentidentityd4 ///
firststickerdummy* teamdummy* preratiow1 lastdebt_demeanedw1 prepaymentsmadedummy* /// ///
, firstpart(probit) secondpart(regress) vce(cluster dayteam)
margins, dydx(treatmentidentityd2 treatmentidentityd3 treatmentidentityd4) nose post
end
bootstrap _b, seed(340) reps(1000): Ey_boot

test treatmentidentityd2 = treatmentidentityd3
test treatmentidentityd2 = treatmentidentityd4
test treatmentidentityd3 = treatmentidentityd4
restore


*** PANEL B ***
preserve
keep if above==1


reg postratiow1 treatmentidentityd2 treatmentidentityd3 treatmentidentityd4 teamdummy* firststickerdummy*, cluster(dayteam)
test treatmentidentityd2 = treatmentidentityd3
test treatmentidentityd2 = treatmentidentityd4
test treatmentidentityd3 = treatmentidentityd4


reg postratiow1 treatmentidentityd2 treatmentidentityd3 treatmentidentityd4 teamdummy* firststickerdummy* preratiow1 lastdebt_demeanedw1 prepaymentsmadedummy* , cluster(dayteam)
test treatmentidentityd2 = treatmentidentityd3
test treatmentidentityd2 = treatmentidentityd4
test treatmentidentityd3 = treatmentidentityd4

capture program drop Ey_boot
program define Ey_boot, eclass
twopm postratiow1 treatmentidentityd2 treatmentidentityd3 treatmentidentityd4 ///
firststickerdummy* teamdummy* preratiow1 lastdebt_demeanedw1 prepaymentsmadedummy* /// ///
, firstpart(probit) secondpart(regress) vce(cluster dayteam)
margins, dydx(treatmentidentityd2 treatmentidentityd3 treatmentidentityd4) nose post
end
bootstrap _b, seed(340) reps(1000): Ey_boot

test treatmentidentityd2 = treatmentidentityd3
test treatmentidentityd2 = treatmentidentityd4
test treatmentidentityd3 = treatmentidentityd4

log close

